package com.mycompany.user.controller;

import com.mycompany.user.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Jintao_Ma on 2017/9/3.
 */
@Controller
public class WebAction {

    Logger logger = LoggerFactory.getLogger(WebAction.class);

    @Autowired
    private UserService userService;
    /**
     * 跳转到用户注册
     * @param
     * @return
     */
    @RequestMapping("/userRegister_Page")
    public ModelAndView userRegister_Page(){
        return new ModelAndView("system/userRegister");
    }

    /**
     * 跳转到组织注册
     * @param
     * @return
     */
    @RequestMapping("/orgRegister_Page")
    public ModelAndView orgRegister_Page(){
        return new ModelAndView("system/orgRegister");
    }

    /**
     * 跳转到登录界面
     */
    @RequestMapping("/getLogin")
    public ModelAndView getLogin(){
        return new ModelAndView("system/login");
    }

    /**
     * 进行登录逻辑处理
     */
    @RequestMapping(value="/login",method = RequestMethod.POST)
    public ModelAndView login(HttpServletRequest request){
        return userService.login(request);
    }

}
